package com.luo.chengrui.module.sa.dal.mysql.datapermission;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import com.luo.chengrui.module.sa.dal.dataobject.datapermission.DataPermissionDetailDO;
import org.apache.ibatis.annotations.Mapper;
import com.luo.chengrui.module.sa.controller.admin.datapermission.vo.*;

/**
 * 数据权限明细 Mapper
 *
 * @author 诚睿
 */
@Mapper
public interface DataPermissionDetailMapper extends BaseMapperX<DataPermissionDetailDO> {

    default PageResult<DataPermissionDetailDO> selectPage(DataPermissionDetailPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<DataPermissionDetailDO>()
                .eqIfPresent(DataPermissionDetailDO::getPersonMemberId, reqVO.getPersonMemberId())
                .likeIfPresent(DataPermissionDetailDO::getTableName, reqVO.getTableName())
                .eqIfPresent(DataPermissionDetailDO::getItemCode, reqVO.getItemCode())
                .eqIfPresent(DataPermissionDetailDO::getDataValue, reqVO.getDataValue())
                .eqIfPresent(DataPermissionDetailDO::getStatus, reqVO.getStatus())
                .eqIfPresent(DataPermissionDetailDO::getVersion, reqVO.getVersion())
                .betweenIfPresent(DataPermissionDetailDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(DataPermissionDetailDO::getId));
    }

    default List<DataPermissionDetailDO> selectList(DataPermissionDetailExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<DataPermissionDetailDO>()
                .eqIfPresent(DataPermissionDetailDO::getPersonMemberId, reqVO.getPersonMemberId())
                .likeIfPresent(DataPermissionDetailDO::getTableName, reqVO.getTableName())
                .eqIfPresent(DataPermissionDetailDO::getItemCode, reqVO.getItemCode())
                .eqIfPresent(DataPermissionDetailDO::getDataValue, reqVO.getDataValue())
                .eqIfPresent(DataPermissionDetailDO::getStatus, reqVO.getStatus())
                .eqIfPresent(DataPermissionDetailDO::getVersion, reqVO.getVersion())
                .betweenIfPresent(DataPermissionDetailDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(DataPermissionDetailDO::getId));
    }

}
